package com.csr.csrcheck.controller;

import com.csr.csrcheck.controller.ex.CompanyException;
import com.csr.csrcheck.pojo.Company;
import com.csr.csrcheck.service.OrganService;
import com.csr.csrcheck.util.JsonResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping({"organ"})
@RestController
public class OrganConntroller extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(com.csr.csrcheck.controller.OrganConntroller.class);

    @Resource
    private OrganService organService;

    @GetMapping({"organlist"})
    public JsonResult<List<Company>> Companylist() {
        List<Company> list = this.organService.getOrganlist();
        if (list == null)
            throw new CompanyException("");
        return new JsonResult(Integer.valueOf(0), "json", list);
    }

    @GetMapping({"organlist2"})
    public JsonResult<List<Company>> Companylist2() {
        List<Company> list = this.organService.getOrganlist2();
        if (list == null)
            throw new CompanyException("");
        return new JsonResult(Integer.valueOf(0), "json", list);
    }
}
